'''
Company: TWL
Author: xue jian
Email: xuejian@kanzhun.com
Date: 2020-10-27 20:45:44
'''
#
# @lc app=leetcode.cn id=122 lang=python3
#
# [122] 买卖股票的最佳时机 II
#

# @lc code=start
class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        from sys import maxsize
        ans = 0
        for i in range(1, len(prices)):
            if prices[i]>prices[i-1]:
                ans += prices[i]-prices[i-1]
        return ans
        
# @lc code=end

